<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner)
    testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);

var testEvent;
window.onload = function() {
    window.location.href = "resources/does-not-exist.html";
    setTimeout(function() {
        shouldBeEqualToString("testEvent.returnValue", "");
        window.stop();
        finishJSTest();
    }, 0);
}

window.addEventListener('beforeunload', function(event) {
    testEvent = event;
    shouldBe("testEvent.__proto__", "BeforeUnloadEvent.prototype");
    return "not supposed to be assigned to returnValue";
}, false);
</script>
</head>
<body>
<script>
description("Tests the returnValue attribute of the BeforeUnloadEvent from an event listener.");
self.jsTestIsAsync = true;
</script>
</body>
</html>

